Revert "cgroup: make sure a parent css isn't offlined before its children"
authorBen Hutchings <ben@decadent.org.uk>
Sat, 5 Mar 2016 23:22:10 +0000 (23:22 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 17 Mar 2016 01:25:23 +0000 (01:25 +0000)
This reverts commit 4cbd196324c05809338c7f118b6f374d3c2db7a0, which
was commit aa226ff4a1ce79f229c6b7a4c0a14e17fececd01 upstream.  It
seems to be a good fix but causes an unfixable ABI change as it
extends a structure that's embedded in other structures.

Gbp-Pq: Topic debian
Gbp-Pq: Name revert-cgroup-make-sure-a-parent-css-isn-t-offlined.patch

include/linux/cgroup-defs.h
kernel/cgroup.c

index 8e30faeab18363cf67be62e76f7ffa3fd2349046..06b77f9dd3f2052ac87f970b8aa8c195b78f7ada 100644 (file)
@@ -133,12 +133,6 @@ struct cgroup_subsys_state {
         */
        u64 serial_nr;
 
-       /*
-        * Incremented by online self and children.  Used to guarantee that
-        * parents are not offlined before their children.
-        */
-       atomic_t online_cnt;
-
        /* percpu_ref killing and RCU release */
        struct rcu_head rcu_head;
        struct work_struct destroy_work;
index 8ffdbc1d94e8fa08975ff3c4b8872ccd210a18b5..580441117b1e7a094800d25f6f94c7dd9d007bb3 100644 (file)
@@ -4784,7 +4784,6 @@ static void init_and_link_css(struct cgroup_subsys_state *css,
        INIT_LIST_HEAD(&css->sibling);
        INIT_LIST_HEAD(&css->children);
        css->serial_nr = css_serial_nr_next++;
-       atomic_set(&css->online_cnt, 0);
 
        if (cgroup_parent(cgrp)) {
                css->parent = cgroup_css(cgroup_parent(cgrp), ss);
@@ -4807,10 +4806,6 @@ static int online_css(struct cgroup_subsys_state *css)
        if (!ret) {
                css->flags |= CSS_ONLINE;
                rcu_assign_pointer(css->cgroup->subsys[ss->id], css);
-
-               atomic_inc(&css->online_cnt);
-               if (css->parent)
-                       atomic_inc(&css->parent->online_cnt);
        }
        return ret;
 }
@@ -5042,15 +5037,10 @@ static void css_killed_work_fn(struct work_struct *work)
                container_of(work, struct cgroup_subsys_state, destroy_work);
 
        mutex_lock(&cgroup_mutex);
-
-       do {
-               offline_css(css);
-               css_put(css);
-               /* @css can't go away while we're holding cgroup_mutex */
-               css = css->parent;
-       } while (css && atomic_dec_and_test(&css->online_cnt));
-
+       offline_css(css);
        mutex_unlock(&cgroup_mutex);
+
+       css_put(css);
 }
 
 /* css kill confirmation processing requires process context, bounce */
@@ -5059,10 +5049,8 @@ static void css_killed_ref_fn(struct percpu_ref *ref)
        struct cgroup_subsys_state *css =
                container_of(ref, struct cgroup_subsys_state, refcnt);
 
-       if (atomic_dec_and_test(&css->online_cnt)) {
-               INIT_WORK(&css->destroy_work, css_killed_work_fn);
-               queue_work(cgroup_destroy_wq, &css->destroy_work);
-       }
+       INIT_WORK(&css->destroy_work, css_killed_work_fn);
+       queue_work(cgroup_destroy_wq, &css->destroy_work);
 }
 
 /**